﻿<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <title>我发布的职位-招聘服务-伯乐网</title>
    <link href="style/css/style.css" type="text/css" rel="stylesheet">
    <link href="style/css/external.min.css" type="text/css" rel="stylesheet">
    <link href="style/css/popup.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="style/js/jquery.1.10.1.min.js"></script>
    <script src="style/js/jquery.lib.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="style/js/ajaxfileupload.js"></script>
    <script src="style/js/additional-methods.js" type="text/javascript"></script>
    <!--layer.js-->
    <script type="text/javascript" src="style/js/layer/layer.js"></script>
</head>

<body>
<div id="body">
    <!--引入顶部导航栏-->
    <div th:replace="public/publicFragment::top_nav_publishJob"></div>
    <!-- 顶部导航栏 end -->


    <div id="container">
        <!--左侧边栏-->
        <div class="sidebar">
            <a class="btn_create" href="/create">发布新职位</a>
            <!--我发布的职位-->
            <dl class="company_center_aside">
                <!--隐藏域存放公司ID-->
                <input type="hidden" id="companyId" th:value="${session.company.companyInfo.id}">
                <dt>我发布的职位</dt>
                <dd id="effectivePosition">
                    <a href="javascript:void(0)">有效职位</a>
                </dd>
                <dd id="invalidPosition" class="current">
                    <a href="javascript:void(0)">已下线职位</a>
                </dd>
                <script>
                    //点击有效职位
                    $("#effectivePosition").click(function () {
                        //获取公司ID
                        var companyId=$("#companyId").val();
                        //跳转到有效职位页面
                        location.href="/effective?companyId="+companyId;
                        return false;
                    });
                    //点击已下线职位
                    $("#invalidPosition").click(function () {
                        //获取公司ID
                        var companyId=$("#companyId").val();
                        //跳转到下线的职位页面
                        location.href="/invalid?companyId="+companyId;
                        return false;
                    });
                </script>
            </dl>
        </div>
        <!-- 左侧边栏 end -->

        <div class="content">
            <dl class="company_center_content">
                <dt>
                    <h1>
                        <em></em>
                        已下线职位 <span></span></h1>
                </dt>
                <dd>
                    <form id="searchForm" th:each="position : ${session.offlinePositions}">
                        <ul class="reset my_jobs">
                            <li>
                                <h3>
                                    <a>[[${position.positionName}]]</a>
                                    <span>[[${position.workCity}]]</span>
                                </h3>
                                <div>[[${position.jobType}]] / [[${position.leastSalary}]]K-[[${position.mostSalary}]]K
                                    / [[${position.workSuffer}]] / [[${position.education}]]
                                </div>
                                <div class="c9">发布时间： [[${position.publishTime}]]</div>
                                <div class="links">
                                    <!--隐藏域存放职位ID-->
                                    <input type="hidden" value="positionId" name="positionId" th:value="${position.id}">
                                    <a class="" onclick="offline(this)" href="javascript:void(0)">重新上线</a>
                                    <a class="" onclick="del(this)" href="javascript:void(0)">删除</a>
                                    <script>
                                        //点击重新上线
                                        function offline(t) {
                                            layer.confirm("是否重新上线当前职位？", {icon: 3}, function (index) {
                                                //获取职位ID
                                                var positionId = $(t).prev().val().trim();
                                                $.ajax({
                                                    type: "post",
                                                    url: "/reOnline/" + positionId,
                                                    success: function (result) {
                                                        //成功的回调函数
                                                        if (result.code == 0) {
                                                            //下线成功，则将当前的这个节点隐藏
                                                            $(t).parent().parent().parent().parent().remove();
                                                            return false;
                                                        } else {
                                                            layer.alert("系统异常,请稍后再试！", {icon: 5});
                                                        }
                                                    }
                                                });
                                                layer.close(index);
                                            });
                                        }

                                        //点击删除
                                        function del(t) {
                                            layer.confirm("是否删除当前职位？", {icon: 3, title: '提示'}, function (index) {
                                                //获取职位ID
                                                var positionId = $(t).prev().prev().val().trim();
                                                $.ajax({
                                                    type: "post",
                                                    url: "/del/" + positionId,
                                                    success: function (result) {
                                                        //成功的回调函数
                                                        if (result.code == 0) {
                                                            //下线成功，则将当前的这个节点隐藏
                                                            $(t).parent().parent().parent().parent().remove();
                                                            return false;
                                                        } else {
                                                            layer.alert("系统异常,请稍后再试！", {icon: 5});
                                                        }
                                                    }
                                                });
                                                layer.close(index);
                                            });
                                        }
                                    </script>
                                </div>
                            </li>
                        </ul>
                    </form>
                </dd>
            </dl>
        </div>
        <!-- end .content -->
        <script src="style/js/job_list.min.js" type="text/javascript"></script>
        <div class="clear"></div>
        <input type="hidden" value="74fb1ce14ebf4e2495270b0fbad64704" id="resubmitToken">
        <a rel="nofollow" title="回到顶部" id="backtop"></a>
    </div>
    <!-- end #container -->
</div>
<!-- end #body -->
<!--引入页面底部备案号-->
<div th:replace="public/publicFragment::footer_nav"></div>

<script src="style/js/core.min.js" type="text/javascript"></script>
<script src="style/js/popup.min.js" type="text/javascript"></script>
<script src="style/js/tongji.js" type="text/javascript"></script>
<!--  -->
<script src="style/js/analytics01.js" type="text/javascript"></script>
<script type="text/javascript" src="style/js/h.js"></script>
<script type="text/javascript">
    $(function () {
        $('#noticeDot-1').hide();
        $('#noticeTip a.closeNT').click(function () {
            $(this).parent().hide();
        });
    });
    var index = Math.floor(Math.random() * 2);
    var ipArray = new Array('42.62.79.226', '42.62.79.227');
    var url = "ws://" + ipArray[index] + ":18080/wsServlet?code=314873";
    var CallCenter = {
        init: function (url) {
            var _websocket = new WebSocket(url);
            _websocket.onopen = function (evt) {
                console.log("Connected to WebSocket server.");
            };
            _websocket.onclose = function (evt) {
                console.log("Disconnected");
            };
            _websocket.onmessage = function (evt) {
                //alert(evt.data);
                var notice = jQuery.parseJSON(evt.data);
                if (notice.status[0] == 0) {
                    $('#noticeDot-0').hide();
                    $('#noticeTip').hide();
                    $('#noticeNo').text('').show().parent('a').attr('href', ctx + '/mycenter/delivery.html');
                    $('#noticeNoPage').text('').show().parent('a').attr('href', ctx + '/mycenter/delivery.html');
                } else {
                    $('#noticeDot-0').show();
                    $('#noticeTip strong').text(notice.status[0]);
                    $('#noticeTip').show();
                    $('#noticeNo').text('(' + notice.status[0] + ')').show().parent('a').attr('href', ctx + '/mycenter/delivery.html');
                    $('#noticeNoPage').text(' (' + notice.status[0] + ')').show().parent('a').attr('href', ctx + '/mycenter/delivery.html');
                }
                $('#noticeDot-1').hide();
            };
            _websocket.onerror = function (evt) {
                console.log('Error occured: ' + evt);
            };
        }
    };
    CallCenter.init(url);
</script>

</body>

</html>